<?php
namespace App\Traits;
use Excel;
trait ExcelTrait
{
    public function excelExport($title,$cellData){
        ini_set('memory_limit','500M');
        set_time_limit(0);//设置超时限制为0分钟
        if($cellData)
        {
            Excel::create($title,function($excel) use ($cellData){
                $excel->sheet('score', function($sheet) use ($cellData){
                    $sheet->rows($cellData);
                });
            })->export('xls');
            die;
        }
    }
}